package bancosys.tec.persist.hibernate;

import java.util.HashMap;
import java.util.Map;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MapKey;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.CollectionOfElements;

import bancosys.tec.persist.bussobj.PersistableBusinessObject;

@Entity
public class ClasseComMapa extends PersistableBusinessObject {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    private Long id;

    private Map<String, String> mapaStringString = new HashMap<String, String>();

    private Map<String, Associacao> mapaStringAssoc = new HashMap<String, Associacao>();

    /**
     * @return the mapaStringString
     */
    @CollectionOfElements
    public Map<String, String> getMapaStringString() {
        return this.mapaStringString;
    }

    /**
     * @param mapaStringString the mapaStringString to set
     */
    public void setMapaStringString(Map<String, String> mapaStringString) {
        this.mapaStringString = mapaStringString;
    }

    /**
     * @return the mapaStringAssoc
     */
    @OneToMany
    @MapKey(name = "nome")
    @Cascade({ CascadeType.SAVE_UPDATE })
    public Map<String, Associacao> getMapaStringAssoc() {
        return this.mapaStringAssoc;
    }

    /**
     * @param mapaStringAssoc the mapaStringAssoc to set
     */
    public void setMapaStringAssoc(Map<String, Associacao> mapaStringAssoc) {
        this.mapaStringAssoc = mapaStringAssoc;
    }

    /**
     * @return the id
     */
    @Id
    @GeneratedValue
    public Long getId() {
        return this.id;
    }

    /**
     * @param id the id to set
     */
    public void setId(Long id) {
        this.id = id;
    }

}
